import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface DeleteDerivedMetricsBatchDelete_ {
  /**
   * @description ids
   */
  ids: number[];
}
export interface GetDerivedMetricsDictionaryApplication_ {
  /**
   * @description appId
   * @format int32
   */
  appId?: number;
  /**
   * @description 指标id
   * @format int32
   * @example 1
   */
  id?: number;
}
export interface GetDerivedMetricsDictionaryNameHint_ {
  /**
   * @description 模糊名称
   */
  cnName?: string;
}
export interface GetDerivedMetricsDictionaryTop50_ {
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
}
export interface GetDerivedMetricsHintNameLimit_ {
  /**
   * @description 搜索关键词
   */
  content?: string;
  /**
   * @description 指标类型
   */
  metricsType?: "ATOMIC" | "DERIVED" | "LOGIC" | "INTERMEDIATE_DERIVED";
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
  /**
   * @description 指标审核状态
   */
  reviewStatus?:
    | "DRAFT"
    | "CREATING"
    | "UNPUBLISHED"
    | "PUBLISHING"
    | "PUBLISHED"
    | "OFFLINEING"
    | "OFFLINED"
    | "DELETING"
    | "CREAT_REJECT"
    | "PUBLISH_REJECT"
    | "OFFLINE_REJECT"
    | "DELETE_REJECT"
    | "DELETED";
  /**
   * @description 基础,衍生类型
   * @format int32
   */
  subType?: number;
  /**
   * @description 主题id
   * @format int32
   */
  subjectId?: number;
}
export interface GetDerivedMetricsList_ {
  /**
   * @description 业务负责人
   */
  businessOwner?: string;
  /**
   * @description 搜索条件
   */
  content?: string;
  /**
   * @description 创建人
   */
  createBy?: string;
  /**
   * @description 部门id
   * @format int32
   */
  departmentId?: number;
  /**
   * @description 我的创建标识
   */
  myCreate?: boolean;
  /**
   * @description 排序顺序,可选的值1:asc:、2:desc，默认2。
   * @format int32
   */
  order?: number;
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
  /**
   * @description 指标审核状态
   */
  reviewStatus?: string;
  /**
   * @description 排序条件,可选的值cnName、id、createBy、reviewStatus、pageviewCount、subType,默认cnName
   */
  sortBy?: string;
  /**
   * @description 基础/衍生类型
   * @format int32
   */
  subType?: number;
  /**
   * @description 主题id
   * @format int32
   */
  subjectId?: number;
  /**
   * @description 技术负责人
   */
  techOwner?: string;
}
export interface GetDerivedMetricsById_ {
  /**
   * @description id
   */
  id: number;
}
export interface PutDerivedMetricsById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteDerivedMetricsById_ {
  /**
   * @description 派生指标id
   */
  id: number;
}

export class DerivedMetrics {
  /**
   * 新增派生指标
   *
   * @tags 派生指标模块
   * @request POST: /derived-metrics
   * @secure
   */
  postDerivedMetrics = (derivedMetricsDTO: defs.DerivedMetricsDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/derived-metrics`,
      method: "POST",
      data: derivedMetricsDTO,
      ...params,
    });

  /**
   * 查询全量派生指标
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/all
   * @secure
   */
  getDerivedMetricsAll = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListFullQueryMetricsVO>({
      url: `/derived-metrics/all`,
      method: "GET",
      ...params,
    });

  /**
   * 批量删除派生指标
   *
   * @tags 派生指标模块
   * @request DELETE: /derived-metrics/batch-delete
   * @secure
   */
  deleteDerivedMetricsBatchDelete = (
    query: { ids: number[] } | DeleteDerivedMetricsBatchDelete_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/derived-metrics/batch-delete`,
      method: "DELETE",
      params: query,
      ...params,
    });

  /**
   * 指标字典指标详情页展示应用信息
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/dictionary-application
   * @secure
   */
  getDerivedMetricsDictionaryApplication = (
    query: { appId?: number; id?: number } | GetDerivedMetricsDictionaryApplication_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListReportInfo>({
      url: `/derived-metrics/dictionary-application`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 指标字典根据指标名称模糊查询指标
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/dictionary/name-hint
   * @secure
   */
  getDerivedMetricsDictionaryNameHint = (
    query: { cnName?: string } | GetDerivedMetricsDictionaryNameHint_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListMetricsQueryVO>({
      url: `/derived-metrics/dictionary/name-hint`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 指标字典查询指标top 50
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/dictionary/top50
   * @secure
   */
  getDerivedMetricsDictionaryTop50 = (
    query: { pageNum?: number; pageSize?: number } | GetDerivedMetricsDictionaryTop50_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsQueryVO>({
      url: `/derived-metrics/dictionary/top50`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 模糊查询获取派生指标下拉列表
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/hint-name-limit
   * @secure
   */
  getDerivedMetricsHintNameLimit = (
    query:
      | {
          content?: string;
          metricsType?: "ATOMIC" | "DERIVED" | "LOGIC" | "INTERMEDIATE_DERIVED";
          pageNum?: number;
          pageSize?: number;
          reviewStatus?:
            | "DRAFT"
            | "CREATING"
            | "UNPUBLISHED"
            | "PUBLISHING"
            | "PUBLISHED"
            | "OFFLINEING"
            | "OFFLINED"
            | "DELETING"
            | "CREAT_REJECT"
            | "PUBLISH_REJECT"
            | "OFFLINE_REJECT"
            | "DELETE_REJECT"
            | "DELETED";
          subType?: number;
          subjectId?: number;
        }
      | GetDerivedMetricsHintNameLimit_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsVO>({
      url: `/derived-metrics/hint-name-limit`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 派生指标列表
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/list
   * @deprecated
   * @secure
   */
  getDerivedMetricsList = (
    query:
      | {
          businessOwner?: string;
          content?: string;
          createBy?: string;
          departmentId?: number;
          myCreate?: boolean;
          order?: number;
          pageNum?: number;
          pageSize?: number;
          reviewStatus?: string;
          sortBy?: string;
          subType?: number;
          subjectId?: number;
          techOwner?: string;
        }
      | GetDerivedMetricsList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsVO>({
      url: `/derived-metrics/list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 根据id获取派生指标
   *
   * @tags 派生指标模块
   * @request GET: /derived-metrics/{id}
   * @deprecated
   * @secure
   */
  getDerivedMetricsById = ({ id }: { id: number } | GetDerivedMetricsById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDerivedMetricsVO>({
      url: `/derived-metrics/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 修改派生指标信息
   *
   * @tags 派生指标模块
   * @request PUT: /derived-metrics/{id}
   * @secure
   */
  putDerivedMetricsById = (
    { id }: { id: number } | PutDerivedMetricsById_,
    derivedMetricsDTO: defs.DerivedMetricsDTO,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/derived-metrics/${id}`,
      method: "PUT",
      data: derivedMetricsDTO,
      ...params,
    });

  /**
   * 删除派生指标
   *
   * @tags 派生指标模块
   * @request DELETE: /derived-metrics/{id}
   * @deprecated
   * @secure
   */
  deleteDerivedMetricsById = ({ id }: { id: number } | DeleteDerivedMetricsById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/derived-metrics/${id}`,
      method: "DELETE",
      ...params,
    });
}

export default new DerivedMetrics();
